package com.dong.controller;

import com.dong.pojo.Image;
import com.dong.service.QueryImageService;
import com.dong.untils.ProcessImage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;

@Controller
public class ImageController {
    @Autowired
    QueryImageService queryImageService;

    //存取图片
    @RequestMapping("/insertImage")
    @ResponseBody
    public void insertImage() throws IOException {
        System.out.println("存取图片");
        String path = "D:\\桌面\\images\\8888.jpg";
        ProcessImage processImage = new ProcessImage();
        processImage.insertImage(path);
    }

    //取出激光设备雷达图片
    @RequestMapping("/getImage")
    @ResponseBody
    public void getImage() throws IOException {
        System.out.println("获取图片");
        String path = "D:\\桌面\\radius-web\\web-first\\src\\main\\resources\\static\\img\\88.png";
        Image image = queryImageService.getImage();
        ProcessImage processImage = new ProcessImage();
        processImage.getImage(path, image);

    }

}
